Covering: bash, ls, cat, mkdir, mv, cd, .., rm, rmdir, cp, tar, gzip, find, .
Naturally this won't work the same for you, because you don't have the same files and directories that I do. But hopefully, it will give you the flavor of how to do some of the basic useful tasks in Unix.
Switch to my preferred shell
bash
What's in the directory?
ls
Can we see more detail?
ls -l
What does all this mean?
permissions, link count, owner, group, size, modifcation time & date, name
Those are all directories. How can we see what's in one of them, say CS3224?
ls CS3224
What directory am I in?
pwd
How do I change directories? Suppose we want to change to CS3224?
cd CS3224
How can we view a file?
cat jabberwock.txt
Looks like we missed something. Can we see it a screen at a time?
more jabberwock.txt
How do we create a directory?
mkdir hacking
How do we make a copy of a file?
cp jabberwock.txt somethingelse.txt
How do we rename a file?
mv somethingelse.txt bettername.txt
If it's called "move", can it do more than just "rename" a file?
mv jabberwock.txt hacking
ls
Where'd it go?
ls hacking
How do we get there?
cd hacking
How do we get back?
cd ..
Ok, let's go down again.
cd hacking
And now we could use some more files...
cp jabberwock.txt sillyname
What about .txt?
ls -l
How do we get rid of sillyname?
rm sillyname
Can I get it back? No??? No one is protecting me from myself?
cp jabberwock.txt sillyname
rm -i sillyname
Does this work for directories?
mkdir tempDir
rm tempDir
So, how do we do that?
rmdir tempDir
What if I want to put a batch of files together, like I do with WinZip
cp jabberwock.txt sillyname
tar cvf myArchive.tar *
How can I be sure that worked?
tar tvf myArchive.tar
But are you sure?
mkdir tempDir
cp myArchive.tar tempDir
cd tempDir
ls -l
tar xvf myArchive.tar
ls -l
But that's not really like doing WinZip! The tar file is large!
gzip myArchive.tar
And how do I get the uncompressed version back?
gunzip myArchive.tar.gz
Once I've made all these directories and files, how can I ever find anything again?
cd
pwd
find . -name silly -print
Great, we've done lots of nothing. How do we compile? The code is in myprogram.cpp and I want the executable to be called superCool
g++ -o superCool myprogram.cpp
How could we find out about this stuff?
man ls
How could we find out what command to use if, for example, we didn't remember that "gzip" was used to compress a file?
man -k compress files
We lost some of the output!
man -k ... | more
And how do we get out of the shell?
exit